IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[ORNEKLER].[FK_MUSTERI_SIPARIS_MUSTERI]') AND parent_object_id = OBJECT_ID(N'[ORNEKLER].[MUSTERI_SIPARIS]'))
ALTER TABLE [ORNEKLER].[MUSTERI_SIPARIS]  WITH CHECK ADD  CONSTRAINT [FK_MUSTERI_SIPARIS_MUSTERI] FOREIGN KEY([MusteriKey])
REFERENCES [ORNEKLER].[MUSTERI] ([MusteriKey])
GO --ExecuteThisSql

ALTER TABLE [ORNEKLER].[MUSTERI_SIPARIS] CHECK CONSTRAINT [FK_MUSTERI_SIPARIS_MUSTERI]
GO --ExecuteThisSql


